import 'package:cached_network_image/cached_network_image.dart';
import 'package:common_utils/common_utils.dart';
import 'package:flustars/flustars.dart';
import 'package:flutter/material.dart';
import 'package:yb_zsyiji_androidflutter_pro/YBHelper/YBColor/YBColor.dart';
import 'package:yb_zsyiji_androidflutter_pro/YBHelper/YBTextStyle/YBTextStyle.dart';
import 'package:yb_zsyiji_androidflutter_pro/YBNetWorkModule/YBAPi/YBAPi.dart';

class YBFindHeaderPage extends StatelessWidget {

  final String headerStr;
  final String puslishUserName;
  final String publishTimeStr;
  final String showTypeStr;

  const YBFindHeaderPage({Key key, this.headerStr, this.puslishUserName, this.publishTimeStr,this.showTypeStr}) : super(key: key);

  @override
  Widget build(BuildContext context) {

    Widget timeContainer;
    if (!ObjectUtil.isEmptyString(showTypeStr)) {
      if (showTypeStr.contains("yijiwang") || showTypeStr.contains("jinrilvsi")) {
        timeContainer = Container(
        );
      }else{

        
        timeContainer = Container(
          child: Text(
            TimelineUtil.formatByDateTime(DateTime.parse(publishTimeStr),locale:"zh",locDateTime:DateTime.now(),dayFormat:DayFormat.Simple)??"",
            style: YBTextStyle.TextStyle90939912,
          ),
        );
      }
    }

    return Container(
      child: Padding(
        padding: EdgeInsets.only(left: YBTextStyle.adapterSize20,top: YBTextStyle.adapterSize16),
        child: Row(
          mainAxisAlignment: MainAxisAlignment.start,
          crossAxisAlignment: CrossAxisAlignment.center,
          children: [
            Container(
              height: YBTextStyle.adapterSize24,
              width: YBTextStyle.adapterSize24,
              decoration: BoxDecoration(
                borderRadius: BorderRadius.all(Radius.circular(YBTextStyle.adapterSize12)),
                image: DecorationImage(
                  image: CachedNetworkImageProvider('${YBApi.Base_image_URL}/$headerStr'),
                )
              ), 
            ),
            Container(
              width: 8,
            ),
            Container(
              child: Text(
                puslishUserName??"",
                style: TextStyle(
                  color: YBColor.color314669,
                  fontSize:YBTextStyle.adapterSize14,
                ),
              ),
            ),
            Container(
              width:YBTextStyle.adapterSize8,
            ),
            timeContainer,
          ],
        ),
      ),
    );
  }
}
